﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Themes/Shared/Seller.master" Inherits="System.Web.Mvc.ViewPage<PagedList<Shop>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CssContent" runat="server">
    <link type="text/css" rel="Stylesheet" href="/Style/Store.css" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="JsContent" runat="server">
<script language="javascript" type="text/javascript">
    $(function () {
        $(".tdlist span").click(function () {
            $(".tdlist li").removeClass("sel");
            $(this).parent().addClass("sel");
            $("#primaryAgent").val($(this).prev().val());
            $(this).prev().attr("checked","checked");
        });
    });
</script>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="MainContent" runat="server">
    <div class="tdlist"><%using (Html.BeginForm()) {%>
        <input type="hidden" id="primaryAgent" name="primaryAgent" />
        <ul>
            <%
                List<AgentsShippedShop> selAgentsShippedShop = ViewData["selAgentsShippedShop"] as List<AgentsShippedShop>;
                if (null != Model)
                {
                    foreach (Shop shop in Model)
                    {
                        bool tag = null != selAgentsShippedShop && selAgentsShippedShop.Any(p => p.ID == shop.ID);
                        %>
                <li <% if(tag){Writer.Write("class=sel");}%>>
                    <input type="checkbox" name="agents" value="<%=shop.ID %>" <% if(tag){
                  Writer.Write("checked=true");                        
                    }%>" />
                    <span><%=shop.FullName%></span></li>
            <%}
                }%>
        </ul>
        <input style="clear:both" type="submit" value="提交" />
<%} %>
    </div>
</asp:Content>
